//package com.example.demo;
//
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//
//@Configuration
//public class Url1Confg {
//    static final String PACKAGE = "com.example.demo.*";
//    private static final String MAPPER_LOCATION = "classpath*:mapper/master/*.xml";
//    private static final String DOMAIN_PACKAGE = "com.xbz.**.domain";
//
//
//    @Bean(name = "masterDataSource")
//    @ConfigurationProperties(prefix = "spring.datasource.primary")
//    @Primary
//    public DataSource masterDataSource(){
//       return  DataSourceBuilder.create().build();
//    }
//
//    @Bean(name = "db_medicalSqlSessionFactory")
//    @Primary
//    public SqlSessionFactory testSqlSessionFactory(@Qualifier("masterDataSource") DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//        bean.setDataSource(dataSource);
//        //xml路径
//        bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/yilife/mapper/db_medical/*.xml"));
//        return bean.getObject();
//    }
//
//    @Bean(name = "db_medicalTransactionManager")
//    @Primary
//    public DataSourceTransactionManager testTransactionManager(@Qualifier("masterDataSource") DataSource dataSource) {
//        return new DataSourceTransactionManager(dataSource);
//    }
//
//    @Bean(name = "db_medicalSqlSessionTemplate")
//    @Primary
//    public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db_medicalSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }
//}
